home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DBVGAL17.ARJ / DEMOS.ARJ / VESAINFO.C < prev    next >
C/C++ Source or Header  |  1992-01-26  |  2KB  |  67 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <dos.h>
  4. #include <string.h>
  5. #include "vesa.h"
  6.  
  7. char    *header0 = "VESAINFO v2.0a\n";
  8. char    *header1 = "The following VESA modes are supported: ";
  9.  
  10. void main(void)
  11. {
  12.     int     i;
  13.     char ts[2];
  14.  
  15.         printf("%s%s",header0,header1);
  16.  
  17.         /* Check if VESA BIOS is present        */
  18.         if (isVESA() == 0) {
  19.            printf("\n...Error: Cannot locate VESA BIOS\n");
  20.            exit(1);
  21.         }
  22.  
  23.         /* Loop over modes, displaying info for each                    */
  24.         for (i = 0; Vinfo.modeptr[i] != EOF; i++) {
  25.             /* Display mode number                                  */
  26.             printf("\n    %4Xh",Vinfo.modeptr[i]);
  27.             printf(" (%s):", Vinfo.modeptr[i] & 0x0100 ? "VESA" : " OEM");
  28.             if (getVESAinfo(Vinfo.modeptr[i]) == NULL) {
  29.                 printf("\nOops. Couldn't retrieve mode info.\n");
  30.                 exit(2);
  31.             }
  32.  
  33.             /* Display mode type (text or graphics)                 */
  34.             printf(" %s ",(Vminfo.modeattr & 0x0010) ? "Graph":"Text ");
  35.             switch (Vminfo.WindowAattr) {
  36.                case 0 : strcpy(ts,"NA"); break;
  37.                case 3 : strcpy(ts,"RO"); break;
  38.                case 5 : strcpy(ts,"WO"); break;
  39.                case 7 : strcpy(ts,"RW"); break;
  40.                default: strcpy(ts,"??"); break;
  41.             }
  42.             printf("WA:%s ",ts);
  43.             switch (Vminfo.WindowBattr) {
  44.                case 0 : strcpy(ts,"NA"); break;
  45.                case 3 : strcpy(ts,"RO"); break;
  46.                case 5 : strcpy(ts,"WO"); break;
  47.                case 7 : strcpy(ts,"RW"); break;
  48.                default: strcpy(ts,"??"); break;
  49.             }
  50.             printf("WB:%s ",ts);
  51.             printf("Gran: %ik  Size: %ik", Vminfo.granularity, Vminfo.size);
  52.  
  53.             /* Display mode resolution                              */
  54.             if (Vminfo.modeattr & 0x0002) {
  55.                printf(" %4d x%4d ", Vminfo.XPixels, Vminfo.YPixels);
  56.  
  57.                /* Display number of colors                             */
  58.                if (Vminfo.modeattr & 0x0008)
  59.                   printf(" %3d Colors", 0x0001 << (Vminfo.bits));
  60.                else
  61.                   printf(" Mono");
  62.             } else
  63.                printf(" N/A\n");
  64.         }
  65.  
  66.         exit(0);
  67. }